<?php
/*
 * @Author: your name
 * @Date: 2020-11-10 13:44:09
 * @LastEditTime: 2020-12-17 13:31:48
 * @LastEditors: Please set LastEditors
 * @Description: 安全管理员数据验证器
 * @FilePath: /special/application/adminapiv3/validate/ManagerValidate.php
 */

namespace app\adminapiv3\validate;


use think\Validate;

class ManagerValidate extends Validate
{
    //验证规则
    protected $rule = [
        //安全管理员ID
        'id|安全管理员ID' => 'require|integer|length:1,10',
        //安全管理员名
        'name|安全管理员名' => 'require|max:50',
        //性别
        'gender|性别' => 'require|in:1,2',
        //所属单位ID
        'ministry_id|所属单位ID' => 'require|integer|length:1,10',
        //联系电话
        'phone|联系电话' => 'require|length:8,20',
    ];

    //错误信息
    protected $message = [
        'name.unique' => '位置名称已存在',
        'gender.in' => '性别格式错误',
    ];

    //验证场景
    protected $scene = [
        //添加
        'add' => ['name','gender','ministry_id','phone'],

        //修改
        'modify' => ['id','name','gender','ministry_id','phone'],

        //删除
        'del' => ['id'],
    ];


}